gtk/gtklevelbar.c: Fix build on non-C99 compilers
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 15 Aug 2012 07:52:01 +0000 (15:52 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Thu, 16 Aug 2012 05:42:13 +0000 (13:42 +0800)
-Include fallback-c89.c for the usage of round(), where an implementation
 of round() is provided for compilers that don't have it
-Use g_ascii_strtod() instead of strtof as strtof() may not be universally
 available.

gtk/gtklevelbar.c

index 7207d01543016bb20d1e24a02c517fd92588c1b5..d82d3857b52a2cbc21d84fb791a9cd231e0ad1cb 100644 (file)
@@ -97,6 +97,8 @@
 #include <math.h>
 #include <stdlib.h>
 
+#include "fallback-c89.c"
+
 #define DEFAULT_BLOCK_SIZE 3
 
 /* these don't make sense outside of GtkLevelBar, so we don't add
@@ -647,7 +649,7 @@ offset_start_element (GMarkupParseContext  *context,
 
       if (name && value_str)
         {
-          offset = gtk_level_bar_offset_new (name, strtof (value_str, NULL));
+          offset = gtk_level_bar_offset_new (name, g_ascii_strtod (value_str, NULL));
           parser_data->offsets = g_list_prepend (parser_data->offsets, offset);
         }
     }